package com.example.myapplication.api;

import com.example.myapplication.adapter.ResultSingerAdapter;
import com.example.myapplication.entity.SearchSinger;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitSearch {
    private SearchSinger result;
    private ResultSingerAdapter adapter;

    public RetrofitSearch(SearchSinger result, ResultSingerAdapter adapter) {
        this.result = result;
        this.adapter = adapter;
    }

    public void loadData(String keyword, int type){
        Retrofit retrofit = new retrofit2.Retrofit.Builder()
                .baseUrl("https://autumnfish.cn/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        MusicApi api = retrofit.create(MusicApi.class);

//        Call<BaseResponseSinger> call = api.getResultSinger(type, keyword);
//        call.enqueue(new Callback<BaseResponseSinger>() {
//            @Override
//            public void onResponse(Call<BaseResponseSinger> call, Response<BaseResponseSinger> response) {
//                BaseResponseSinger baseResponse = response.body();
//                if (baseResponse.isSuccess()){
//                    result = baseResponse.getResult();
//                    adapter.setData();
//                }
//            }
//
//            @Override
//            public void onFailure(Call<BaseResponseSinger> call, Throwable t) {
//
//            }
//        });
    }
}
